home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 3.2 KB | 160 lines | [TEXT/CWIE] |
- // GrowBelowArrangement.cp
-
- #ifndef GrowBelowArrangement_h
- #include "GrowBelowArrangement.h"
- #endif
- #ifndef MinMax_h
- #include "MinMax.h"
- #endif
-
- GrowBelowArrangement::GrowBelowArrangement( WindowFocus& focus )
- : grow( focus )
- {
- BottomLine().SetView( bottomLine );
- Grow().SetView( grow );
- }
-
- void GrowBelowArrangement::Arrange( Rectangle bounds )
- {
- Rectangle grow( bounds.right - barSize,
- bounds.bottom - barSize,
- bounds.right,
- bounds.bottom );
-
- Rectangle main( bounds.left,
- bounds.top,
- bounds.right,
- grow.top );
-
- Rectangle bottomLine( bounds.left,
- grow.top,
- grow.left,
- grow.top + 1 );
-
- Rectangle bottomBar( bounds.left,
- bottomLine.bottom,
- grow.left,
- bounds.bottom );
-
- Main().SetBounds( main );
- Bottom().SetBounds( bottomBar );
- BottomLine().SetBounds( bottomLine );
- Grow().SetBounds( grow );
- }
-
- uint16 GrowBelowArrangement::MinimumHeight() const
- {
- uint16 size = Main().Size().MinimumHeight();
-
- Assert( size <= maxint16 - barSize );
-
- return size + barSize;
- }
-
- uint16 GrowBelowArrangement::MinimumWidth() const
- {
- uint16 size = Bottom().Size().MinimumWidth();
-
- Assert( size <= maxint16 - barSize );
-
- size += barSize;
-
- return Max( size, Main().Size().MinimumWidth() );
- }
-
- uint16 GrowBelowArrangement::MaximumHeight() const
- {
- uint16 size = Main().Size().MaximumHeight();
-
- if ( size >= maxint16 - barSize )
- return maxint16;
-
- return size + barSize;
- }
-
- uint16 GrowBelowArrangement::MaximumWidth() const
- {
- uint16 size = Bottom().Size().MaximumWidth();
-
- if ( size >= maxint16 - barSize )
- size = maxint16;
- else
- size += barSize;
-
- return Max( size, Main().Size().MaximumWidth() );
- }
-
- uint16 GrowBelowArrangement::ReasonableHeight() const
- {
- uint16 size = Main().Size().ReasonableHeight();
-
- Assert( size <= maxint16 - barSize );
-
- return size + barSize;
- }
-
- uint16 GrowBelowArrangement::ReasonableWidth() const
- {
- uint16 size = Bottom().Size().ReasonableWidth();
-
- Assert( size <= maxint16 - barSize );
-
- size += barSize;
-
- return Max( size, Main().Size().ReasonableWidth() );
- }
-
- uint16 GrowBelowArrangement::BestHeight() const
- {
- uint16 size = Main().Size().BestHeight();
-
- Assert( size <= maxint16 - barSize );
-
- return size + barSize;
- }
-
- uint16 GrowBelowArrangement::BestHeight( uint16 bound ) const
- {
- if ( bound <= barSize )
- return bound;
-
- bound -= barSize;
-
- uint16 size = Main().Size().BestHeight( bound );
- size = Min( size, bound );
-
- Assert( size <= maxint16 - barSize );
-
- return size + barSize;
- }
-
- uint16 GrowBelowArrangement::BestWidth() const
- {
- uint16 size = Main().Size().BestWidth();
-
- Assert( size <= maxint16 - barSize );
- size += barSize;
-
- size = Min( size, Bottom().Size().MaximumWidth() );
- size = Max( size, Bottom().Size().MinimumWidth() );
-
- return size - barSize;
- }
-
- uint16 GrowBelowArrangement::BestWidth( uint16 bound ) const
- {
- uint16 size = Main().Size().BestWidth( bound );
-
- Assert( size <= maxint16 - barSize );
- size += barSize;
-
- size = Min( size, Bottom().Size().MaximumWidth() );
- size = Max( size, Bottom().Size().MinimumWidth() );
-
- size -= barSize;
-
- size = Min( size, bound );
-
- return size;
- }
-